﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSConsoleTest
{
    class TestDynamicType : BaseConsoleTest
    {
        public void printDescription()
        {
            Console.WriteLine("--- Dynamic type ---");
        }

        public void doTest()
        {
            dynamic[] dynamicAnimals = new dynamic[] { new DynamicDog(), new DynamicPig() };
            foreach (dynamic dynamicAnimal in dynamicAnimals)
            {
                dynamicAnimal.cry();
            }
        }
    }

    class DynamicDog
    {
        public void cry()
        {
            Console.WriteLine("Bow wow!!");
        }
    }

    class DynamicPig
    {
        public void cry()
        {
            Console.WriteLine("Oink Oink!!");
        }
    }
}
